<?php

declare(strict_types=1);

namespace ImiApp\ApiServer\Api\Model\Base;

use Imi\Config\Annotation\ConfigValue;
use Imi\Model\Annotation\Column;
use Imi\Model\Annotation\DDL;
use Imi\Model\Annotation\Entity;
use Imi\Model\Annotation\Table;
use ImiApp\ImiServer\AbstractModel as Model;

/**
 * 地区表 基类.
 *
 * @Entity(camel=false, bean=true, incrUpdate=false)
 * @Table(name=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\Area.name", default="fa_area"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\Area.poolName"))
 * @DDL(sql="CREATE TABLE `fa_area` (
  `id` int(10) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `pid` int(10) DEFAULT NULL COMMENT '父id',
  `shortname` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '简称',
  `name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名称',
  `mergename` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '全称',
  `level` tinyint(4) unsigned DEFAULT NULL COMMENT '层级:1=省,2=市,3=区/县,4=街道/乡镇',
  `pinyin` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '拼音',
  `code` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '长途区号',
  `zip` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '邮编',
  `first` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '首字母',
  `lng` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '经度',
  `lat` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '纬度',
  `user_id` int(10) unsigned DEFAULT NULL COMMENT '售后站用户',
  PRIMARY KEY (`id`),
  KEY `pid` (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='地区表'", decode="")
 *
 * @property int|null $id ID
 * @property int|null $pid 父id
 * @property string|null $shortname 简称
 * @property string|null $name 名称
 * @property string|null $mergename 全称
 * @property int|null $level 层级:1=省,2=市,3=区/县,4=街道/乡镇
 * @property string|null $pinyin 拼音
 * @property string|null $code 长途区号
 * @property string|null $zip 邮编
 * @property string|null $first 首字母
 * @property string|null $lng 经度
 * @property string|null $lat 纬度
 * @property int|null $userId 售后站用户
 */
abstract class AreaBase extends Model
{
    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEY = 'id';

    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEYS = ["id"];

    /**
     * ID.
     * id
     * @Column(name="id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $id = NULL;

    /**
     * 获取 id - ID.
     *
     * @return int|null
     */
    public function getId(): ?int
    {
        return $this->id;
    }

    /**
     * 赋值 id - ID.
     * @param int|null $id id
     * @return static
     */
    public function setId($id)
    {
        $this->id = null === $id ? null : (int)$id;
        return $this;
    }

    /**
     * 父id.
     * pid
     * @Column(name="pid", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $pid = NULL;

    /**
     * 获取 pid - 父id.
     *
     * @return int|null
     */
    public function getPid(): ?int
    {
        return $this->pid;
    }

    /**
     * 赋值 pid - 父id.
     * @param int|null $pid pid
     * @return static
     */
    public function setPid($pid)
    {
        $this->pid = null === $pid ? null : (int)$pid;
        return $this;
    }

    /**
     * 简称.
     * shortname
     * @Column(name="shortname", type="varchar", length=100, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $shortname = NULL;

    /**
     * 获取 shortname - 简称.
     *
     * @return string|null
     */
    public function getShortname(): ?string
    {
        return $this->shortname;
    }

    /**
     * 赋值 shortname - 简称.
     * @param string|null $shortname shortname
     * @return static
     */
    public function setShortname($shortname)
    {
        $this->shortname = null === $shortname ? null : (string)$shortname;
        return $this;
    }

    /**
     * 名称.
     * name
     * @Column(name="name", type="varchar", length=100, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $name = NULL;

    /**
     * 获取 name - 名称.
     *
     * @return string|null
     */
    public function getName(): ?string
    {
        return $this->name;
    }

    /**
     * 赋值 name - 名称.
     * @param string|null $name name
     * @return static
     */
    public function setName($name)
    {
        $this->name = null === $name ? null : (string)$name;
        return $this;
    }

    /**
     * 全称.
     * mergename
     * @Column(name="mergename", type="varchar", length=255, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $mergename = NULL;

    /**
     * 获取 mergename - 全称.
     *
     * @return string|null
     */
    public function getMergename(): ?string
    {
        return $this->mergename;
    }

    /**
     * 赋值 mergename - 全称.
     * @param string|null $mergename mergename
     * @return static
     */
    public function setMergename($mergename)
    {
        $this->mergename = null === $mergename ? null : (string)$mergename;
        return $this;
    }

    /**
     * 层级:1=省,2=市,3=区/县,4=街道/乡镇.
     * level
     * @Column(name="level", type="tinyint", length=4, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $level = NULL;

    /**
     * 获取 level - 层级:1=省,2=市,3=区/县,4=街道/乡镇.
     *
     * @return int|null
     */
    public function getLevel(): ?int
    {
        return $this->level;
    }

    /**
     * 赋值 level - 层级:1=省,2=市,3=区/县,4=街道/乡镇.
     * @param int|null $level level
     * @return static
     */
    public function setLevel($level)
    {
        $this->level = null === $level ? null : (int)$level;
        return $this;
    }

    /**
     * 拼音.
     * pinyin
     * @Column(name="pinyin", type="varchar", length=100, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $pinyin = NULL;

    /**
     * 获取 pinyin - 拼音.
     *
     * @return string|null
     */
    public function getPinyin(): ?string
    {
        return $this->pinyin;
    }

    /**
     * 赋值 pinyin - 拼音.
     * @param string|null $pinyin pinyin
     * @return static
     */
    public function setPinyin($pinyin)
    {
        $this->pinyin = null === $pinyin ? null : (string)$pinyin;
        return $this;
    }

    /**
     * 长途区号.
     * code
     * @Column(name="code", type="varchar", length=100, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $code = NULL;

    /**
     * 获取 code - 长途区号.
     *
     * @return string|null
     */
    public function getCode(): ?string
    {
        return $this->code;
    }

    /**
     * 赋值 code - 长途区号.
     * @param string|null $code code
     * @return static
     */
    public function setCode($code)
    {
        $this->code = null === $code ? null : (string)$code;
        return $this;
    }

    /**
     * 邮编.
     * zip
     * @Column(name="zip", type="varchar", length=100, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $zip = NULL;

    /**
     * 获取 zip - 邮编.
     *
     * @return string|null
     */
    public function getZip(): ?string
    {
        return $this->zip;
    }

    /**
     * 赋值 zip - 邮编.
     * @param string|null $zip zip
     * @return static
     */
    public function setZip($zip)
    {
        $this->zip = null === $zip ? null : (string)$zip;
        return $this;
    }

    /**
     * 首字母.
     * first
     * @Column(name="first", type="varchar", length=50, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $first = NULL;

    /**
     * 获取 first - 首字母.
     *
     * @return string|null
     */
    public function getFirst(): ?string
    {
        return $this->first;
    }

    /**
     * 赋值 first - 首字母.
     * @param string|null $first first
     * @return static
     */
    public function setFirst($first)
    {
        $this->first = null === $first ? null : (string)$first;
        return $this;
    }

    /**
     * 经度.
     * lng
     * @Column(name="lng", type="varchar", length=100, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $lng = NULL;

    /**
     * 获取 lng - 经度.
     *
     * @return string|null
     */
    public function getLng(): ?string
    {
        return $this->lng;
    }

    /**
     * 赋值 lng - 经度.
     * @param string|null $lng lng
     * @return static
     */
    public function setLng($lng)
    {
        $this->lng = null === $lng ? null : (string)$lng;
        return $this;
    }

    /**
     * 纬度.
     * lat
     * @Column(name="lat", type="varchar", length=100, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $lat = NULL;

    /**
     * 获取 lat - 纬度.
     *
     * @return string|null
     */
    public function getLat(): ?string
    {
        return $this->lat;
    }

    /**
     * 赋值 lat - 纬度.
     * @param string|null $lat lat
     * @return static
     */
    public function setLat($lat)
    {
        $this->lat = null === $lat ? null : (string)$lat;
        return $this;
    }

    /**
     * 售后站用户.
     * user_id
     * @Column(name="user_id", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $userId = NULL;

    /**
     * 获取 userId - 售后站用户.
     *
     * @return int|null
     */
    public function getUserId(): ?int
    {
        return $this->userId;
    }

    /**
     * 赋值 userId - 售后站用户.
     * @param int|null $userId user_id
     * @return static
     */
    public function setUserId($userId)
    {
        $this->userId = null === $userId ? null : (int)$userId;
        return $this;
    }

}
